package com.example.controller;

import com.alibaba.fastjson.JSON;
import com.example.model.Book;
import com.example.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by yimi on 2016/12/19.
 */

@RestController
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping(value = "/getAllBook")
    public String getAllBook(ModelMap model){

        List<Book> list = bookService.getAll();
        return JSON.toJSONString(list);
    }

}
